<?php

use think\migration\Migrator;
use think\migration\db\Column;

class DeliverDriverWithdraw extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $this->table('deliver_driver_withdraw')
             ->addColumn('deliver_driver_id', 'integer', ['limit' => 11, 'default' => 0, 'after' => 'id', 'comment' => '司机ID'])
             ->addColumn('no', 'string', ['limit' => 32, 'default' => '', 'after' => 'deliver_driver_id', 'comment' => '编号'])
             ->addColumn('amount', 'decimal', ['precision' => 10, 'scale' => 2, 'default' => 0.00, 'after' => 'no', 'comment' => '提现金额'])
             ->addColumn('remark', 'string', ['limit' => 255, 'default' => '', 'after' => 'amount', 'comment' => '备注'])
             ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'after' => 'remark', 'comment' => '1:待审核,2:已审核,3:已拒绝'])
             ->addColumn('create_time', 'integer', ['limit' => 10, 'after' => 'status', 'default' => 0, 'comment' => '创建时间'])
             ->addColumn('update_time', 'integer', ['limit' => 10, 'after' => 'create_time', 'default' => 0, 'comment' => '更新时间'])
             ->addColumn('delete_time', 'integer', ['limit' => 10, 'after' => 'update_time', 'default' => 0, 'comment' => '删除时间'])
             ->addColumn('audit_time', 'integer', ['limit' => 10, 'after' => 'delete_time', 'default' => 0, 'comment' => '审核完成时间'])
             ->create();
    }
}
